<?php
include 'AdminController.php';
class Admin_IndexController extends Admin_AdminController
{
	public function init(){
		//レイアウトを設定
        $layoutPath = APPLICATION_PATH . '/templates/admin/admin';
        $option = array('layout' => 'index', 'layoutPath' => $layoutPath);
        Zend_Layout::startMvc($option);
        
        //アクティブメニューを設定
        $this->view->active_menu = "home";
        
	}
	
    public function indexAction ()
    {
    	Zend_Loader::loadClass("RoomModel");
    	Zend_Loader::loadClass("OrderModel");
    	
    	$request = $this->getRequest();
    	$view = $this->view;
    	
        $date = $request->getParam("date", date("Y-m-j"));
			
		//get list room
		$room_model = new RoomModel();
		$order_model = new OrderModel();
		
		$room_list = $room_model->getListRoom("all", "", 0);
		foreach ($room_list as &$room){
			$room['order_list'] = $order_model->getListOrderOnRoom($room['id'], $date);
		}
		
		//put data to view
		$view->room_list = $room_list;
		$view->date = $date;
		
		//TODO Navigator を設定
    	$nav['ホーム'] = "/admin";
    	$nav['ダッシュボード'] = "/admin";
    	$view->nav = $nav;
    }
}